package com.chis.jxc;

import com.chis.jm.bean.jxc.CntstmInfoBean;
import com.chis.jmdatatimer.comm.JedisConnect;
import com.chis.jmdatatimer.comm.JedisSerializeUtil;
import com.chis.jmdatatimer.comm.TxMgmtModule;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2019年03月19日
 */
public class TestJxccode {
    /**
     * 1查询
     * 2修改
     * @param args
     */
    public static void main(String[] args) {
        try {

            String keys = args[0];

            ShardedJedisPool jedisPool = JedisConnect.getInstance().jedisPoolJxc;
            ShardedJedis jedis = jedisPool.getResource();

            ShardedJedisPool jedisPoolOld = JedisConnect.getInstance().jedisPoolJxc;
            ShardedJedis jedisOld = jedisPoolOld.getResource();

            jedis.select(3);
            jedisOld.select(3);
            for(String key : keys.split(",")){
                System.out.println("========="+key);
                Map<String,String> elecCodeMap = jedisOld.hgetAll(key);
                jedis.hmset(key,elecCodeMap);
                jedis.expire(key,1209600);
            }

            jedis.close();
            jedisOld.close();

            System.out.println("====success====");
            
        } catch (Exception e){
            e.printStackTrace();
        }



    }
}
